<template>
  <div class="c-bg-sgray c-ph24 c-pv20">
    <div class="c-bg-white c-ph20 c-pv20 c-mb20 c-br16" v-for="(item, index) in promotedAccountList" :key="index">
      <div class="c-flex-row c-aligni-center">
        <div class="c-w0 c-flex-grow1">
          <div class="c-fs26 c-fc-xblack c-fw600 c-text-ellipsis1">{{item.pageName}}</div>
          <div class="c-fs22 c-fc-gray c-mt14"><span class="icon iconfont c-fs24 c-mr10">{{item.address ? '&#xe8a3;' : ''}}</span>{{item.address}}</div>
        </div>
        <div @click="goMicroPage(item.mId)" class="c-ww110 c-hh36 c-br20 c-fs20 c-fc-white c-flex-row c-flex-center theme-bg c-ml20">查看详情</div>
      </div>
    </div>
    <loading-status-tem :noData="promotedAccountList.length == 0" :noDataText="'暂无子店铺'"></loading-status-tem>
  </div>
</template>

<script>
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import { utilJs } from "@/utils/common.js"
export default {
  name: 'PromotedAccountList',
  components: {
    loadingStatusTem
  },
  props: [],
  beforeCreate() {

  },
  data() {
    return {
      promotedAccountList: []
    }
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {

  },
  computed: {

  },
  watch: {

  },
  methods: {
    goMicroPage(mId) {
      this.$routerGo(this, "push", { path: "/homePage/microPage/microPage", query: {'mId': mId, 'isPromotedAccount': 1} });
    },
    getPromotedAccountList() {
      utilJs.getMethod(`${global.apiurl}promotedAccount/getMinPage`, res => {
        this.promotedAccountList = res ? res : [];
      });
    },
    //分享
    wechatShare: function () {
      let title = '子店铺列表';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`;
      utilJs.wechatConfig(shareUrl, title, "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      let title = '子店铺列表';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}`;
      utilJs.appShareTrue(title, "", shareUrl, "");
    }
  },
  activated() {
    this.promotedAccountList = [];
    this.getPromotedAccountList();
    setDocumentTitle("子店铺列表");// eslint-disable-line
    this.wechatShare();
  },
  deactivated() {

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
